#include "kernelprivate.h"
#include "mapplication.h"
#include "mobject.h"
#include "mevent.h"
#include "mdir.h"
#include "errno.h"

MEventPrivate::MEventPrivate(MEvent *q) :
	q_ptr(q)
{

}

MEventPrivate::~MEventPrivate()
{

}

/*------------------------------------------------------------------*/

MIOEventPrivate::MIOEventPrivate(MEvent *q) :
	MEventPrivate(q)
{

}

MIOEventPrivate::~MIOEventPrivate()
{

}

/*------------------------------------------------------------------*/

MPaintEventPrivate::MPaintEventPrivate(MEvent *q) :
	MEventPrivate(q)
{

}

MPaintEventPrivate::~MPaintEventPrivate()
{

}

/*------------------------------------------------------------------*/

MTimerEventPrivate::MTimerEventPrivate(MEvent *q) :
	MEventPrivate(q)
{

}

MTimerEventPrivate::~MTimerEventPrivate()
{

}

/*------------------------------------------------------------------*/

MObjectPrivate::InvalidObjList MObjectPrivate::inv_obj_list;

MObjectPrivate::MObjectPrivate(MObject *q) :
	q_ptr(q)
{

}

MObjectPrivate::~MObjectPrivate()
{

}

MObjectPrivate::ReciverInfo::ReciverInfo(const void *revice_addr, CallBack slot_addr) :
	reciver_addr(revice_addr), slot_addr(CallBack(slot_addr))
{

}

MObjectPrivate::TriggerInfo::TriggerInfo() :
	block(false)
{

}

void MObjectPrivate::init()
{
	is_valid = true;
	block = false;
	delete_later = false;
}

/*------------------------------------------------------------------*/

MEventLoopPrivate::MEventLoopPrivate(MObject *q) :
	MObjectPrivate(q)
{

}

MEventLoopPrivate::~MEventLoopPrivate()
{

}

/*------------------------------------------------------------------*/

MWidgetPrivate::MWidgetPrivate(MObject *q) :
	MObjectPrivate(q)
{

}

MWidgetPrivate::~MWidgetPrivate()
{

}

void MWidgetPrivate::init()
{
	rect.move(mApp->desktop().width() >> 2, mApp->desktop().height() >> 2);
	rect.resize(mApp->desktop().width() >> 1, mApp->desktop().height() >> 1);
	bcolor.set(240, 240, 240);
	title = "Widget";
	state = Jxq::Normal;
	visible = false;
	full = false;
	attr = Jxq::AlloweRsize | Jxq::AlloweDagAndDrop | Jxq::AlloweMaximum | Jxq::AlloweMinimum | Jxq::HaveBorder;
	flags = Jxq::Window;
	closed = false;
}

/*------------------------------------------------------------------*/

MIODevicePrivate::MIODevicePrivate(MObject *q) :
	MObjectPrivate(q)
{

}

MIODevicePrivate::~MIODevicePrivate()
{

}

const char *MIODevicePrivate::get_error_message(int err_num)
{
	switch( err_num )
	{
		case 0: return "Success";
		case -ENOENT: return "No such file or directory";
		case -EBADF: return "Bad file number";
		case -ENOMEM: return "Not enough space";
		case -EACCES: return "Permission denied";
		case -EBUSY: return "Device or resource busy";
		case -EEXIST: return "File exists";
		case -ENODEV: return "No such device";
		case -EINVAL: return "Invalid argument";
		case -ENOSYS: return "Function not implemented";
		default:break;
	}
	return "Unkwon error";
}

MTimerPrivate::MTimerPrivate(MObject *q) :
	MObjectPrivate(q)
{

}

MTimerPrivate::~MTimerPrivate()
{

}

#ifdef FILE_SYSTEM_FAT32

MFileDevicePrivate::MFileDevicePrivate(MObject *q) :
	MIODevicePrivate(q)
{

}

MFileDevicePrivate::~MFileDevicePrivate()
{

}

MFilePrivate::MFilePrivate(MObject *q) :
	MFileDevicePrivate(q)
{

}

MFilePrivate::~MFilePrivate()
{

}

MDirPrivate::MDirPrivate(MDir *q) :
	q_ptr(q)
{

}

MDirPrivate::~MDirPrivate()
{

}

#endif //FILE_SYSTEM_FAT32

